package com.efo.common.exception;

import com.efo.common.result.ResultEnum;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * @Package: com.efo.common.exception
 * @Description: 通用异常类
 * @Author CHY
 * @Create 2021年11月08日 15时03分25秒
 */
@Data
@NoArgsConstructor
public class BaseException extends RuntimeException{
    private static final long serialVersionUID = 456123064123123L;

    /* 返回信息枚举 */
    private ResultEnum resultEnum;
    /* 错误码 */
    private String errorCode;
    /* 错误信息 */
    private String errorMessage;

    public BaseException(ResultEnum resultEnum) {
        super(resultEnum.getMsg());
        this.resultEnum = resultEnum;
        this.errorCode = resultEnum.getCode();
        this.errorMessage = resultEnum.getMsg();
    }
}
